package com.lixiangfeiyang.recycleritemhelperdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.lixiangfeiyang.recycleritemhelperdemo.databinding.ActivityMainBinding

class TextActivity : AppCompatActivity() {

    var list = arrayListOf<Int>()
    private lateinit var adapter: ImageAdapter


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val viewBinding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(viewBinding.root)


        for (index in 1..10) {
            list.add(index)
        }

        viewBinding.recyclerList.layoutManager = LinearLayoutManager(this)
       var textAdapter = TextAdapter(list)
        viewBinding.recyclerList.adapter = textAdapter
        val linearItemTouchHelperUtil = LinearItemTouchHelperUtil(false, textAdapter).init()
        linearItemTouchHelperUtil.attachToRecyclerView(viewBinding.recyclerList)

    }
}